<template>
	<view>
		<van-tabs @change="changeTab" color="#3080FB" animated :lazy-render="false" :active="active">
			<van-tab :title-style="active == 0 ? 'color: #3080FB': ''" title="基本信息">
				<basicInfo ref="basicInfo" />
			</van-tab>
			<van-tab :title-style="active == 1 ? 'color: #3080FB': ''" title="巡检记录">
				<checkRecordList ref="checkRecordList" />
			</van-tab>
			<van-tab :title-style="active == 2 ? 'color: #3080FB': ''" title="整改记录">
				<rectificationRecordList ref="rectificationRecordList" />
			</van-tab>
			<van-tab :title-style="active == 3 ? 'color: #3080FB': ''" title="台账记录">
				<account-record></account-record>
			</van-tab>
		</van-tabs>
	</view>
</template>

<script>
	import AccountRecord from './accountRecord.vue'
	import basicInfo from './basicInfo.vue'
	import checkRecordList from './checkRecordList.vue'
	import rectificationRecordList from './rectificationRecordList.vue'
	export default {
		components: {
			AccountRecord,
			basicInfo,
			checkRecordList,
			rectificationRecordList
		},
		data() {
			return {
				active: 0,
				id: null,
				gridId:null
			}
		},
		onLoad(option) {
			if (option) {
				this.id = parseInt(option.id)
				this.gridId = parseInt(option.gridId)
				// this.$refs.basicInfo.getInfo(this.id);
				// this.$refs.checkRecordList.getRecordList(this.id,this.gridId);
				// this.$refs.rectificationRecordList.getRecordList(this.id,this.gridId);
			}
		},
		onShow() {
			this.$refs.basicInfo.getInfo(this.id);
			this.$refs.checkRecordList.getRecordList(this.id,this.gridId);
			this.$refs.rectificationRecordList.getRecordList(this.id,this.gridId);
		},
		methods: {
			changeTab(name, title) {
				console.log(name, title)
				this.active = name.target.index
			}
		},
	}
</script>

<style>

</style>
